﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data.Common;
using System.Data;
using DataAccessClasses;

namespace mobliebo
{
    public class invoice_list
    {
        iDAC DAC = DACFactory.GetDAC();
        private long _invoice_id = -99;
        private long _phone_id = -99;
        private long _rate = -99;
        private string _quantity = "";
        private long _amount = -99;
        private bool _is_deleted = false;
        public bool is_deleted
        {
            get
            {
                return _is_deleted;
            }
            set
            {
                _is_deleted = value;
            }

        }
        public long invoice_id
        {
            get
            {
                return _invoice_id;
            }
            set
            {
                _invoice_id = value;
            }

        }
        public long phone_id
        {
            get
            {
                return _phone_id;
            }
            set
            {
                _phone_id = value;
            }

        }
        public long rate
        {
            get
            {
                return _rate;
            }
            set
            {
                _rate = value;
            }

        }
        public long amount
        {
            get
            {
                return _amount;
            }
            set
            {
                _amount = value;
            }

        }
        public string quantity
        {
            get
            {
                return _quantity;
            }
            set
            {
                _quantity = value;
            }
        }
        public long SaveRecords()
        {
            try
            {
                DbParameter dbparam0 = DAC.Parameter("@invoice_id", invoice_id, DbType.Int64, ParameterDirection.Input);
                DbParameter dbparam1 = DAC.Parameter("@phone_id", phone_id, DbType.Int64, ParameterDirection.Input);
                DbParameter dbparam2 = DAC.Parameter("@rate", rate, DbType.Int64, ParameterDirection.Input);
                DbParameter dbparam3 = DAC.Parameter("@quantity", quantity, DbType.AnsiString, ParameterDirection.Input);
                DbParameter dbparam4 = DAC.Parameter("@amount", amount, DbType.Int64, ParameterDirection.Input);
                DbParameter dbparam5 = DAC.Parameter("@is_deleted", is_deleted, DbType.Boolean, ParameterDirection.Input);

                DbParameter[] dbparamcall = new DbParameter[] { dbparam0, dbparam1, dbparam2, dbparam3, dbparam4, dbparam5 };
                return DAC.Save("invoice_list_save", dbparamcall);
            }
            catch (Exception ex)
            {
                long result = -99;
            }
            return -99;
        }
        public DataTable GetRecords(long invoice_id, long phone_id, long rate, string quantity, long amount, bool is_deleted, string andor)
        {
            try
            {
                DbParameter dbparam0 = DAC.Parameter("@invoice_id", invoice_id, DbType.Int64, ParameterDirection.Input);
                DbParameter dbparam1 = DAC.Parameter("@phone_id", phone_id, DbType.Int64, ParameterDirection.Input);
                DbParameter dbparam2 = DAC.Parameter("@rate", rate, DbType.Int64, ParameterDirection.Input);
                DbParameter dbparam3 = DAC.Parameter("@quantity", quantity, DbType.AnsiString, ParameterDirection.Input);
                DbParameter dbparam4 = DAC.Parameter("@amount", amount, DbType.Int64, ParameterDirection.Input);
                DbParameter dbparam5 = DAC.Parameter("@is_deleted", is_deleted, DbType.Boolean, ParameterDirection.Input);
                DbParameter dbparam6 = DAC.Parameter("@andor", andor, DbType.AnsiString, ParameterDirection.Input);
                DbParameter[] dbparamcall = new DbParameter[] { dbparam0, dbparam1, dbparam2, dbparam3, dbparam4, dbparam5, dbparam6 };
                return DAC.Select("invoice_list_get", dbparamcall);
                DataTable dt1 = DAC.Select("invoice_list_get", dbparamcall);
                return dt1;
            }
            catch (Exception ex)
            {
                long result = -99;
            }
            return null;
        }
    }
}